package AliDiepPR.ANN.ActivationFunction;

//Bipolar Sigmoid activation function
//
//                1
// f(x) = ------------------ - 0.5
//        1 + exp(-alfa * x)
//
// Outpur range: [-0.5, 0.5]
//
public class BipolarSigmoidFunction implements IActivationFunction {

	double alfa = 1f;

    public BipolarSigmoidFunction()
    {
    }

    public BipolarSigmoidFunction(double alfa)
    {
        this.alfa = alfa;
    }

	@Override
	public void Alfa(double alfa) {
		this.alfa = alfa;
	}

	@Override
	public double output(double x) {
		return (double)((1 / (1 + Math.exp(-alfa * x))) - 0.5);
	}

	@Override
	public double output2(double y) {
		return (double)(alfa * (0.25 - y * y));
	}
	
	public String ToString() {
		return "Bipolar Sigmoid Function";
	}
}
